home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_bab_courtyard_grid_1.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  325 lines

  1. # Jones 3D Cog Script
  2. #
  3. # BAB_Courtyard_Grid_1.cog
  4. # [JM]
  5. #
  6. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  7. #
  8. # ========================================================================================
  9.  
  10.  
  11. symbols
  12.  
  13.  
  14. message         startup
  15. message         entered
  16. message         arrived
  17. message         activated
  18. message         killed 
  19. message         crossed
  20.  
  21. # ========================================================================================
  22.  
  23.  
  24. # GHOST OBJECTS - THE GRID
  25.  
  26. thing   t_ghost00
  27. thing   t_ghost01
  28. thing   t_ghost02
  29. thing   t_ghost03
  30. thing   t_ghost04
  31. thing   t_ghost05
  32. thing   t_ghost06
  33. thing   t_ghost07
  34. thing   t_ghost08
  35. thing   t_ghost09
  36. thing   t_ghost10
  37. thing   t_ghost11
  38. thing   t_ghost12
  39. thing   t_ghost13
  40. thing   t_ghost14
  41. thing   t_ghost15
  42. thing   t_ghost16
  43. thing   t_ghost17
  44. thing   t_ghost18
  45. thing   t_ghost19
  46. thing   t_ghost20
  47. thing   t_ghost21
  48. thing   t_ghost22
  49. thing   t_ghost23
  50.  
  51.  
  52. # ALL COMMIES - Patrolling and Guarding
  53.  
  54. thing   t_commie00      LinkID=1  
  55. thing   t_commie01      LinkID=1
  56. thing   t_commie02      LinkID=1
  57. thing   t_commie03      LinkID=1    
  58. thing   t_commie04      LinkID=1
  59. thing   t_commie05      LinkID=1
  60. thing   t_commie06      LinkID=1    
  61. thing   t_commie07      LinkID=1    
  62. thing   t_commie08      LinkID=1
  63. thing   t_commie09      LinkID=1
  64. thing   t_commie10      LinkID=1
  65.  
  66. # PATROLLING COMMIES - Redundant with commies above
  67.  
  68. thing   t_patrol00
  69. thing   t_patrol01
  70.  
  71. thing   AfterTurnerCommie00     #Commies that roam after the turner cutscene.
  72. thing   AfterTurnerCommie01
  73.  
  74. # OTHER REFERENCES
  75.  
  76. thing   turner_door
  77.  
  78. thing   power_switch
  79.  
  80. sector  sec_trigger
  81.  
  82. sector  SecLinkGrid0    LinkID=2    #Sector checks to link upper and lower grids if Indy gets to the lower area.
  83. sector  SecLinkGrid1    LinkID=2
  84. sector  SecLinkGrid2    LinkID=2
  85. sector  SecLinkGrid3    LinkID=2
  86.  
  87. surface     Turner_cutscene_trigger 
  88.  
  89. #------------------------LOCAL VARIABLES-----------------------
  90.  
  91. thing   t_player        local
  92.  
  93. int     n_wpnts=24      local   # number of waypoints in the grid
  94. int     n_commies=11    local   # number of commies to use the grid                                       
  95. int     n_pos           local
  96.  
  97. int     counter         local
  98.  
  99. int     check0=0        local
  100. int     check1=0        local
  101.  
  102. int     TurnerCheck=0   local
  103.  
  104. int     cur_wpnt        local
  105. int     next_wpnt       local
  106.  
  107. flex    grid_create     local
  108. flex    assign_instinct local
  109. flex    start_patrol    local
  110.  
  111. end
  112. # ========================================================================================
  113.  
  114. code
  115. //----------------------------------------------------------------------------------------
  116.  
  117. startup:
  118.     
  119.     t_player = GetLocalPlayerThing();
  120.                              
  121.     SetThingFlags(AfterTurnerCommie00, 0x80000); # Commies don't exist until after the turner cutscene
  122.     SetThingFlags(AfterTurnerCommie01, 0x80000);
  123.         
  124.     return;                                                                        
  125.                                                                         
  126.  
  127. //----------------------------------------------------------------------------------------
  128.      
  129. entered:    
  130.     
  131.     //Initial Sector Trigger to set up the grid                                                                
  132.     if (GetSenderRef() == sec_trigger)  
  133.     {   
  134.         if(check0 == 0)
  135.         {
  136.             
  137.             check0 = 1;
  138.      
  139.             //print("Activating courtyard patrol grid");
  140.        
  141.             call grid_create;
  142.             
  143.             call assign_instinct;
  144.         }
  145.     }    
  146.     
  147.     //Link Upper and lower Grids so that patrolling commies dont go into the wrong area until they're supposed to
  148.     if (GetSenderID() == 2)
  149.     {
  150.         if(Check1 == 0)
  151.         {
  152.             Check1 = 1;
  153.             
  154.             AIConnectWpnts(6, 7);
  155.             
  156.             call start_patrol; 
  157.             
  158.             //print("Grids Linked");
  159.         }
  160.     }  
  161.     return;        
  162.     
  163.  # ====================================================================
  164. crossed:
  165.     
  166.     if(GetSenderRef() == Turner_cutscene_trigger)
  167.     {
  168.         if(TurnerCheck == 1) return;
  169.         TurnerCheck = 1;
  170.         
  171.         for(counter = 0; counter < n_commies; counter = counter + 1)
  172.         {
  173.             if(Commie00[counter] != -1)
  174.             {
  175.                 AISetCutsceneMode(Commie00[counter]);
  176.             }                  
  177.         }
  178.     }       
  179.     return;
  180.                         
  181. //----------------------------------------------------------------------------------------
  182. arrived:
  183.     
  184.     //Link sub_grids once Turner cutscene has played... i.e. door is now open.
  185.     if (GetSenderRef() == turner_door)
  186.     {
  187.         //print("Linked Turner sub-Grid");
  188.         AIConnectWpnts(17, 19);     
  189.         
  190.         for(counter = 0; counter < n_commies; counter = counter + 1)
  191.         {
  192.             if(Commie00[counter] != -1)
  193.             {
  194.                 AIClearCutsceneMode(Commie00[counter]);
  195.             }
  196.         }
  197.             
  198.         
  199.         //Wake up two sleeping commies and set them a roamin'
  200.         
  201.         ClearThingFlags(AfterTurnerCommie00, 0x80000);  
  202.         ClearThingFlags(AfterTurnerCommie01, 0x80000);    
  203.         
  204.         AISetInstinctWpntMode(AfterTurnerCommie00);
  205.         AISetInstinctWpntMode(AfterTurnerCommie01);
  206.         
  207.         AIEnableInstinct(AfterTurnerCommie00, "roam", 1);
  208.         AIEnableInstinct(AfterTurnerCOmmie01, "roam", 1);
  209.     }                                                    
  210.     
  211.     return;
  212.  
  213.         
  214. //----------------------------------------------------------------------------------------
  215. activated:
  216.  
  217.     //Comimes up top begin to roam once Indy pulls the lever
  218.     if(GetSenderRef() == power_switch)  
  219.     {
  220.         //print("AI turned on and roaming");
  221.         
  222.         for(n_pos = 0; n_pos < 5; n_pos = n_pos+1)
  223.         {
  224.             if(t_commie00[n_pos] != -1)     //Check ot see if the commie is dead
  225.             {
  226.                 AIClearCutsceneMode(t_commie00[n_pos]);
  227.                 AIEnableInstinct(t_commie00[n_pos], "roam", 1);
  228.             }
  229.         }
  230.     }
  231.     
  232.     return;
  233. //----------------------------------------------------------------------------------------
  234. killed:
  235.     
  236.     //Check for dead commies so as not to assign an instinct to a commie that no longer exists
  237.     for(n_pos = 0; n_pos < n_commies; n_pos = n_pos+1)
  238.     {
  239.         if(GetSenderRef() == t_commie00[n_pos])
  240.         {
  241.             t_commie00[n_pos] = -1;
  242.         }
  243.     }
  244.  
  245.     return;
  246.  
  247. //----------------------------------------------------------------------------------------
  248.  
  249. grid_create:        
  250.     
  251.     //ASSIGNMENT OF SLOTS, RANKS AND LINKS THAT DEFINE THE GRID
  252.  
  253.     
  254.     for (n_pos = 0; n_pos < n_wpnts; n_pos = n_pos+1)
  255.     {
  256.         AISetWpnt(t_ghost00[n_pos], n_pos);     //assigns each waypoint slot a ghost object 
  257.         //AISetWpntRank(n_pos, 1);                //Set all waypoints equal rank (1) for now... 
  258.     }
  259.     
  260.     // LINK WAYPOINTS TO FORM THE GRID STRUCTURE
  261.     // Upper Grid
  262.     AIConnectWpnts(0, 1);
  263.     AIConnectWpnts(1, 2);
  264.     AIConnectWpnts(1, 3);
  265.     AIConnectWpnts(2, 4);
  266.     AIConnectWpnts(3, 6);
  267.     AIConnectWpnts(4, 5);
  268.     AIConnectWpnts(4, 6);
  269.     
  270.     //Lower Grid
  271.     //AIConnectWpnts(6, 7);
  272.     AIConnectWpnts(7, 8);
  273.     AIConnectWpnts(8, 9);
  274.     AIConnectWpnts(9, 10);
  275.     AIConnectWpnts(10, 11);
  276.     AIConnectWpnts(10, 13);
  277.     AIConnectWpnts(10, 14);
  278.     AIConnectWpnts(11, 12);
  279.     AIConnectWpnts(14, 15);
  280.     AIConnectWpnts(14, 16);                                             
  281.     AIConnectWpnts(16, 17);
  282.     AIConnectWpnts(17, 18);
  283.     
  284.     // Sub-Grid on other side of Turner Door.
  285.     AIConnectWpnts(19, 20);     
  286.     AIConnectWpnts(20, 21);
  287.     AIConnectWpnts(20, 22);
  288.     AIConnectWpnts(22, 23);
  289.   
  290.     //print("Grid created");
  291.     
  292.     return;
  293.  
  294. //----------------------------------------------------------------------------------------
  295.  
  296. assign_instinct:    
  297.     
  298.     //SET ALL COMMIES TO USE THE GRID FOR FLEEING AND PURSUING
  299.     //print("Instinct set");
  300.     
  301.     for (n_pos = 0; n_pos < n_commies; n_pos = n_pos+1)
  302.     {       
  303.         AISetInstinctWpntMode(t_commie00[n_pos]); 
  304.     } 
  305.     
  306.     return;
  307.  
  308. //----------------------------------------------------------------------------------------
  309.         
  310. start_patrol:
  311.  
  312.     //Set some of the commies to patrol, or 'roam' in this case
  313.     //print("Commies Patrolling");
  314.               
  315.     AIEnableInstinct(t_patrol00, "roam", 1);
  316.     AIEnableInstinct(t_patrol01, "roam", 1);
  317.     
  318.     return;
  319.     
  320. //----------------------------------------------------------------------------------------
  321.  
  322. end    
  323.     
  324.